package com.generator.rate.controller;


import cn.hutool.core.date.DateUtil;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.thymeleaf.expression.Lists;

import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 班级徽章配置 前端控制器
 * </p>
 *
 * @author tiankun
 * @since 2023-09-21
 */
@RestController
@RequestMapping("/rate/sch-medal-config-entity")
public class SchMedalConfigController {

    public static void main(String[] args) {
        // 获取当前时间
        LocalDateTime now = LocalDateTime.now();
        // 获取上周的开始时间
        LocalDateTime lastWeekStart = now.minusWeeks(1).with(DayOfWeek.MONDAY);
        List<String> weekList = new ArrayList<>();
        DateTimeFormatter formatDate = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        for (int i = 0; i < 7; i++){
            LocalDateTime localDateTime = lastWeekStart.plusDays(i);
            weekList.add(formatDate.format(localDateTime));
        }
        System.out.println(weekList);
    }

}

